LOG_TXT=log.txt

help:
	@printf "\
	ABCDEsOS \n\n\
	usage: make [target]\n\n\
	target list:\n\
		flp:	to generate empty floppy image\n\
		mbr_h:	assembly hello mbr program\n\
		cp_mbr:	copy mbr.bin to floppy image\n\
		clean:	clean build-time files\n\
		c:	Build all, that may\n\
		d:	Build all, that may and run qemu\n\
	"
flp:
	@echo "Generate empty floppy image."
	@dd if=/dev/zero of=floppy.img bs=1024 count=1440  

mbr_h:
	@echo "Assembly hello mbr."
	@as -o mbr.o mbr.s
	@ld --oformat binary -Ttext 0x7c00 -o mbr.bin mbr.o

cp_mbr: 
	@echo "Copy mbr.bin to floppy image."
	@dd if=mbr.bin of=floppy.img conv=notrunc

clean:
	@rm -f *.o *.bin a.out
	@rm -f floppy.img

c: clean flp mbr_h cp_mbr
	@echo 
d: c
	qemu -fda floppy.img
	@echo 
	
